package org.learn.java;

public class Binary {

	public static void main(String[] args) {
		int n = Integer.parseInt(args[0]);
		Binary binary = new Binary();
		for (int i = 0; i <= n; i++)			
			binary.binary(i);
	}

	public void binary(int n) {
		int v = 1;
		int bits = 0;
		while (v <= n / 2)
			v *= 2;

		while (v != 0) {
			++bits;
			if (n >= v) {
				System.out.print("1");
				n = n - v;
			} else {
				System.out.print("0");
			}
			v /= 2;

		}

		System.out.println("       BITS: " + bits);
	}

}
